#include "game.h"
#include "actor.h"
#include "actorManager.h"
#include "stageManager.h"

StageManager::StageManager(Game *g, int w, int h){
    game=g;
    width=w;
    height=h;
    buffer=create_bitmap(SCREEN_W, SCREEN_H);
}

StageManager::~StageManager(){
    destroy_bitmap(buffer);
}

int StageManager::w(){
    return width;
}

int StageManager::h(){
    return height;
}

void StageManager::update(){
    draw();
}

void StageManager::draw(){
    Actor *tmp;
    game->actor_manager->rewind();
    clear(buffer);
    while ((tmp=game->actor_manager->next())!=NULL){
        tmp->draw(buffer);
    }
    // 14 pixels abajo para el marcador de fps
    blit(buffer, screen, 0,0,0,14,SCREEN_W, SCREEN_H);
}
